import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import Home from '../pages/home/Home'
import Order from '../pages/order/Order'
import Seat from '../pages/seat/Seat'
import Student from '../pages/student/Student'
import Ticket from '../pages/ticket/Ticket'

const router = createBrowserRouter([
    {
        path: '/', element: <App></App>,
        children: [
            {index:true,element:<Home></Home>},
            {
                path: 'home',
                lazy: async () => {
                    const { default: Home } = await import('../pages/home/Home')
                    return {
                        element: <Home></Home>
                    }
                }

            },
            {
                path: 'order',
                lazy: async () => {
                    const { default: Order } = await import('../pages/order/Order')
                    return {
                        element: <Order></Order>
                    }
                }

            },
            {
                path: 'student',
                lazy: async () => {
                    const { default: Student } = await import('../pages/student/Student')
                    return {
                        element: <Student></Student>
                    }
                }

            },
            {
                path: 'seat',
                lazy: async () => {
                    const { default: Seat } = await import('../pages/seat/Seat')
                    return {
                        element: <Seat></Seat>
                    }
                }

            },
            {
                path: 'ticket',
                lazy: async () => {
                    const { default: Ticket } = await import('../pages/ticket/Ticket')
                    return {
                        element: <Ticket></Ticket>
                    }
                }

            },
            
        ]
    }
])

export default router